-module(user_register).
-compile(export_all).


index('GET', Req) ->
    template:render_html(Req, "user/register", []);

index('POST', Req) ->
    PostData = Req:parse_post(),
    Username = proplists:get_value("username", PostData, ""),
    Password = proplists:get_value("password", PostData, ""),
    model_user:insert(Username, Password),
    template:render_html(Req, "user/register", [{username, chat_util:md5(Username)}]).
